Smart Home

FEMS REST API guide

Published: 28.09.2024
Python REST

Introduction

To retrieve values, a GET request to the following address has to be sent: http://[IP]:80/rest/channel/[COMPONENT]/[CHANNEL]. You have to replace [IP] with the IP-Adress of the FEMS and [COMPONENT]/[CHANNEL] according to which values you would like to retrieve. For the request to be successful, the Authorization header has to be set with the password "user" and a username of your choice (e.g.: "x").

API values

This is a list of components and their channels that I found interesting. The list is not complete. More (but not all) components and channels can be found in the official documentation here and here. To get every available channel for a component see the example scripts below. To know which components you have simply click on the green tick in the top right corner of the FEMS online monitoring dashboard.
Component Channels Notes
meter0
(grid meter)
Frequency power grid frequency
battery0
(the first battery)
Tower0PackVoltage
Tower0NoOfCycles number of charging cycles
Tower0Module0Cell000Voltage
Tower0TemperaturePreMos
Current
State state of this battery (ok, info, warning, fault)
Soh state of health
Soc state of charge
Capacity rated capacity of this battery
MaxCellTemperature
MinCellTemperature
_sum
(sum of the whole system)
EssSoc state of charge
GridMode
EssActivePower charging power (negative), discharging power (positive)
EssReactivePower
EssActiveChargeEnergy
EssActiveDischargeEnergy
EssCapacity rated battery capacity
State global state of the whole system
GridBuyActiveEnergy energy consumption from grid
GridSellActiveEnergy energy sold to grid
ProductionActivePower
ConsumptionActivePower
ConsumptionActiveEnergy
batteryInverter0
(the first battery inverter)
AirTemperature
BmsPackTemperature
RadiatorTemperature
WbmsTemperature
pvInverter0 Current
Voltage
ActiveProductionEnergy AC lifetime active energy output

The values from _sum will always return the sum of the whole system, e.g. if you have only one battery, _sum/EssSoc and battery0/Soc will return the same value.

Example: Python

Here is a quick example on how to get the state of charge with python: import requests url = "http://192.168.0.0:80/rest/channel/_sum/EssSoc" username = "x" password = "user" session = requests.Session() session.auth = (username, password) response = session.get(url) response.raise_for_status() print(response.text) The response will be in the JSON format and could look like this: {"address": "_sum/EssSoc", "type": "INTEGER", "accessMode": "RO", "text": "Range 0..100", "unit": "%", "value": 75} Multiple values can be retrieved with one request by listing multiple channels like so: url = "http://192.168.0.0:80/rest/channel/battery0/(Tower0PackVoltage|Current|Soh)" Now the response will contain the three requested values Tower0PackVoltage, Current and Soh (state of health). All possible values/channels for a component can be requested by using (.*) as channel: url = "http://192.168.0.0:80/rest/channel/battery0/(.*)" Now we can print all the available addresses: for entry in response.json(): print(entry.get("address")) If you have for example multiple batteries, you can retrieve the same values for every battery with one request by replacing the number in the component name with .+ like this: url = "http://192.168.0.0:80/rest/channel/battery.+/Soc" The URL above can be used to get the state of charge for every battery.

Sources

[1]
FEMS App REST/JSON Lese-/Schreibzugriff :: FENECON Dokumente
[2] FEMS Glossar :: FENECON Dokumente
[3] Fenecon Home und das Rest-API